<?php
// +----------------------------------------------------------------------
// | HisiPHP框架[基于ThinkPHP5.1开发]
// +----------------------------------------------------------------------
// | Copyright (c) 2016-2021 http://www.HisiPHP.com
// +----------------------------------------------------------------------
// | HisiPHP承诺基础框架永久免费开源，您可用于学习和商用，但必须保留软件版权信息。
// +----------------------------------------------------------------------
// | Author: 橘子俊 <364666827@qq.com>，开发者QQ群：50304283
// +----------------------------------------------------------------------

namespace app\system\admin;  

use think\Db; 

/**
 * 用户管理控制器
 * @package app\system\admin
 */
class Tixian extends Admin
{ 
    /**
     * 待审核-列表
     */
    public function index(){  
        $tx_list = Db::name('tixian')->where("sh_status = 0")->paginate(20)->each(function($item, $key){
            $item['dlname'] = Db::name("daili")->where("id = '{$item['dl_id']}'")->value("dlname");;
            return $item;
        }); 
        $this->assign('tx_list', $tx_list); 
        return $this->fetch();
    }
    
    /**
     * 已提现列表
     */
    public function indexYtx(){
        $tx_list = Db::name('tixian')->where("sh_status = 1")->paginate(20)->each(function($item, $key){
            $item['dlname'] = Db::name("daili")->where("id = '{$item['dl_id']}'")->value("dlname");;
            return $item;
        });
        $this->assign('tx_list', $tx_list);
        return $this->fetch();
    }
    
    /**
     * 确认提现
     */ 
    public function qrtx(){
        $id = $this->request->param('id');
        $data['sh_status'] = 1;
        $data['shsj'] = time();
        $data['cw_id'] = ADMIN_ID;
        $res = Db::name('tixian')->where("id = '{$id}'")->update($data);
        if($res){
            $this->success("提现成功！",url('tixian/index'));
        }else{
            $this->error("提现失败！");
        }
    }
}
